

<!--
All rights Reserved, Designed By www.youyacao.com
@Description:基础配置
@author:成都市一颗优雅草科技有限公司
@version V4.2
注意：本前端源码遵循 MIT开源协议本内容仅限于个人参考，禁止用于其他的商业用途
需要商业用途或者定制开发等可访问songshu.youyacao.com   联系QQ:422108995 23625059584
开源gitee地址：https://gitee.com/youyacao/songshu-video-page
 -->

<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-calendar"></i> 站点配置
        </el-breadcrumb-item>
        <el-breadcrumb-item>基本配置</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="form-box">
        <el-form ref="form" :model="form" label-width="150px">


          <el-form-item label="网站标题">
            <el-input v-model="form.title"></el-input>
          </el-form-item>
          <el-form-item label="网站域名">
            <el-input v-model="form.website"></el-input>
          </el-form-item>
          <el-form-item label="管理员邮箱">
            <el-input v-model="form.mail"></el-input>
          </el-form-item>
          <el-form-item label="管理员QQ">
            <el-input v-model="form.qq"></el-input>
          </el-form-item>
          <el-form-item label="推荐奖励最小值">
            <el-input v-model="form.bonus_start"></el-input>
          </el-form-item>
          <el-form-item label="推荐奖励最大值">
            <el-input v-model="form.bonus_end"></el-input>
          </el-form-item>
          <el-form-item label="金币换算单位">
            <el-input v-model="form.gold_rate"></el-input> 1元所换金币数
          </el-form-item>
          <el-form-item label="最低提现金币数">
            <el-input v-model="form.withdraw_min"></el-input>
          </el-form-item>
          <el-form-item label="是否关闭">
            <el-input v-model="form.isopen"></el-input>
          </el-form-item>
          <el-form-item label="分享地址">
            <el-input v-model="form.share_url"></el-input>
          </el-form-item>
          <el-form-item label="版权信息">
            <el-input v-model="form.copyright"></el-input>
          </el-form-item>


          <el-form-item>
            <el-button type="primary" @click="onSubmit">提交</el-button>
            <el-button>取消</el-button>


          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
  import qs from 'Qs'
  export default {
    name: 'baseform',
    data() {
      return {
        form: {
        }
      };
    },
    created(){
      this.getData();
    },
    methods: {
      getData(){
        this.$api.config.get({}).then((res)=>{
          this.form = res.data;
        });
      },
      onSubmit() {
        var data = [];
        for(let item in this.form){
          data[`config[${item}]`]=this.form[item];
        }
        console.log(data);
        this.$api.config.set(qs.stringify(data)).then((res)=>{
          console.log(res.data);
        });
        this.$message.success('提交成功！');
      }
    }
  };
</script>
